<?php
class basicNetwork_prepared extends model
{
    
    const ValidRule_id_network_prepared_isInt = 'ValidRule-id_network_prepared-isInt';
    const ValidRule_id_network_prepared_exists = 'ValidRule-id_network_prepared-exists';
    const ValidRule_id_network_isInt = 'ValidRule-id_network-isInt';
    const ValidRule_id_network_exists = 'ValidRule-id_network-exists';
    const ValidRule_file_exists = 'ValidRule-file-exists';

	
    public $id_network_prepared;
    public $id_network;
    public $file;
    public $name;
    public $information;


	public static function loadModel($id=null, $join=null)
	{
		$obiekt = new Network_prepared($id, $join);
		if(!$obiekt ->isNull())
			return $obiekt;
		else return null;
	}
				
	public static function loadSpecialModel($where){
		$stmt = self::$pdo -> query("SELECT * FROM Network_prepared WHERE $where LIMIT 1;");
		$row = $stmt -> fetch(PDO::FETCH_ASSOC);
		if(!$row)
			return self::loadModel();
		$model = self::loadModel();
		$model -> SetValues($row);
		$model -> NewRecord = false;
		return $model;
	}

	public static function getAll($where=null)
	{
		return model::getAll('Network_prepared', $where);
	}

	public function __construct($id=null, $join = null)
	{
		parent::__construct($id, $join);
		$this -> labels = array(
            'id_network_prepared' => 'id_network_prepared', 
            'id_network' => 'id_network', 
            'file' => 'file',
            'name' => 'Name',
            'information' => 'information'
        );
	}

		
	public function getTableName()
	{
		return 'Network_prepared';
	}

	public function getPrimaryKey()
	{
		return 'id_network_prepared';
	}

	public function getColumns()
	{
		return array('id_network_prepared', 'id_network', 'file', 'name', 'information');
	}

	protected function getBoolColumns()
	{
		return array();
	}

	public function getRules($ignore=array())
	{
		$rules = array(
            'ValidRule-id_network_prepared-isInt' => new ValidRule('id_network_prepared', isInt, array(&$this->id_network_prepared)),
            'ValidRule-id_network_prepared-exists' => new ValidRule('id_network_prepared', exists, array(&$this->id_network_prepared)),
            'ValidRule-id_network-isInt' => new ValidRule('id_network', isInt, array(&$this->id_network)),
            'ValidRule-id_network-exists' => new ValidRule('id_network', exists, array(&$this->id_network)),
            'ValidRule-file-exists' => new ValidRule('file', exists, array(&$this->file))	
        );			

		if(!empty($ignore))
		{
			if(!is_array($ignore)) $ignore = array($ignore);
			foreach($ignore as $field)
			{
				unset($rules[$field]);
			}
		}
		return $rules;

	}

    protected function getJoinTables() {
        return array('network');
    }


}
?>